<?php
# 总配置
$rules = require __DIR__ . '/conf/rules.php';
$mysql = require __DIR__ . '/config/mysql.php';
$mysql_slave = require __DIR__ . '/config/mysql_slave.php';
$redis = require __DIR__ . '/config/redis.php';
return [
    'id' => 'app',
    'basePath' => __DIR__,
    'controllerNamespace' => 'app\controllers',
    'components' => [

        'mysql' => $mysql,

        'mysql_slave' => $mysql_slave,

        'redis' => $redis,

        'err' => function () {
            return require __DIR__ . '/conf/err.php';
        },

        'system' => function () {
            return require __DIR__ . '/config/system.php';
        },

        'urlManager' => [

            # 开启URL美化
            'enablePrettyUrl' => true,

            # 隐藏index.php
            'showScriptName' => true,

            # 路由严格匹配模式
            'enableStrictParsing' => true,

            # rules 路由
            'rules' => $rules
        ],

        'request' => [

            # 'enableCookieValidation' => false,

            'cookieValidationKey' => '7c4a8d09ca3762af61e59520943dc26494f8941b',

            # 关闭跨站请求验证
            'enableCsrfValidation' => false,

            # 接收json
            'parsers' => [
                'application/json' => 'yii\web\JsonParser',
                'text/json' => 'yii\web\JsonParser',
            ]
        ]
    ]
];